unit NuevoComponenteReparacion;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Base, StdCtrls, Buttons, Grids, DBGrids, ExtCtrls, XPMan,
  ToolWin, ComCtrls;

type
  TfrmNuevoComponente = class(TfrmBase)
    DBGrid1: TDBGrid;
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    procedure FormShow(Sender: TObject);
    procedure DBGrid1DblClick(Sender: TObject);
    procedure BitBtn2Click(Sender: TObject);
    procedure BitBtn1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  frmNuevoComponente: TfrmNuevoComponente;

implementation

uses Datos, AltaReparacion;

{$R *.dfm}

procedure TfrmNuevoComponente.FormShow(Sender: TObject);
begin
  inherited;
  frmdatos.tblComponentesStock.Active:=true;
  DBGrid1.DataSource:=frmdatos.dsComponentesStock;
  frmdatos.tblComponentesStock.Refresh;
  frmDatos.tblComponentesStock.First;
end;

procedure TfrmNuevoComponente.DBGrid1DblClick(Sender: TObject);
begin
  inherited;
  if frmDatos.tblComponentesStock.RecordCount>0 then
    begin
      frmAltaReparacion.ltsComponentesUsados.Items.Add(DBGrid1.Fields[0].Value);
      Close;
    end;
end;

procedure TfrmNuevoComponente.BitBtn2Click(Sender: TObject);
begin
  inherited;
  Close;
end;

procedure TfrmNuevoComponente.BitBtn1Click(Sender: TObject);
begin
  inherited;
  if frmDatos.tblComponentesStock.RecordCount>0 then
    begin
      frmAltaReparacion.ltsComponentesUsados.Items.Add(DBGrid1.Fields[0].Value);
      Close;
    end;  
end;

end.
